package com.cicc.beergamevirtualsimulationsystem.common.webSocket.handler.impl;

import com.cicc.beergamevirtualsimulationsystem.common.webSocket.config.WebSocketMessageSender;
import com.cicc.beergamevirtualsimulationsystem.common.webSocket.handler.JsonMessageHandler;
import com.cicc.beergamevirtualsimulationsystem.common.webSocket.message.Impl.CurrentDataJsonWebSocketMessage;
import com.cicc.beergamevirtualsimulationsystem.common.webSocket.message.Impl.InitRoomJsonWebSocketMessage;
import com.cicc.beergamevirtualsimulationsystem.common.webSocket.message.Impl.SomeoneChoosesRoleJsonWebSocketMessage;
import com.cicc.beergamevirtualsimulationsystem.common.webSocket.message.WebSocketMessageTypeEnum;
import com.cicc.beergamevirtualsimulationsystem.entity.RoomInfoManager;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;

@Component
public class SomeoneChoosesRoleJsonMessageHandler implements JsonMessageHandler<SomeoneChoosesRoleJsonWebSocketMessage> {
    @Override
    public void handle(WebSocketSession session, SomeoneChoosesRoleJsonWebSocketMessage message) {
//        String roomId = session.getAttributes().get("roomId").toString();
//        String id = session.getAttributes().get("userId").toString();
//        //
//        String roomInfo = RoomInfoManager.getRoomInfo(roomId, id);
//        WebSocketMessageSender.send(session, new CurrentDataJsonWebSocketMessage(roomInfo));

    }

    @Override
    public String type() {
        return WebSocketMessageTypeEnum.SOMEONE_CHOOSES_ROLE.getValue();
    }

    @Override
    public Class<SomeoneChoosesRoleJsonWebSocketMessage> getMessageClass() {
        return SomeoneChoosesRoleJsonWebSocketMessage.class;
    }
}
